function flushCheckCode() {
	var obj = document.getElementById("checkcode");
	obj.src = 'CheckCode.do?d=' + new Date();
}
$(document).ready(function() {
	$("form").submit(function() {
		$.post("Login.do", $("form").serialize(), function(result) {
			result = eval('(' + result + ')');
			if (result.status != undefined) {
				if (result.status == "ok") {
					window.location.href = "admin.jsp";
					return false;
				}
				if (result.status == 'error') {
					if (result.msg != undefined) {
						alert(result.msg);
						flushCheckCode();
						return false;
					}
				}
			}
			var tip = "";
			if (result.username != undefined) {
				tip += result.username + "\r\n";
			}
			if (result.userpassword != undefined) {
				tip += result.userpassword + "\r\n";
			}
			alert(tip);
			flushCheckCode();
		});
		return false;
	});
})